<?php

     session_start();
     include('../includes/config.php');
     include('../includes/SmartSQL.php');

     $DB = new SmartSQL;
     $DB->setinfo($db_server,$db_username,$db_password,$db_name);
     $DB->sql_connect();
     $DB->sql_selectdb();

     include('../includes/param.class.php');

     $Param = new SmartParam;
     $Param->param();


     if ($_GET['login'] == 1)
     {
         $password = md5($_POST['T2']);
         $check    = $DB->sql_query("SELECT * FROM " . $db_prefix . "member WHERE username='" . $_POST['T1'] . "' AND password='" . $password . "'");
         $num      = $DB->sql_num_rows($check);

         if ($num != 0)
         {
             $member_row = $DB->sql_fetch_array($check);

             $groupper_query = $DB->sql_query("SELECT * FROM " . $db_prefix . "group WHERE id='" . $member_row['usergroup'] . "'");
             $groupper_row   = $DB->sql_fetch_array($groupper_query);

             if ($groupper_row['admincp_allow'] == 1)
             {
                 $MySBB_Admin = $_POST['T1'];

                 session_register(MySBB_Admin_username);
                 setcookie('MySBB_Admin_username' , ''.$_POST['T1'].'');
                 setcookie('MySBB_Admin_password' , ''.$password.'');

                 echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php\">\n";
             }
             else
             {
                 die('غير مسموح لك الوصول إلى لوحة التحكم');
             }
         }
         else
         {
             die('<div align="center"><font face="Tahoma">كلمة السر او اسم المستخدم خطأ !</font></div>');
         }
     }


?>